import 'package:flutter/material.dart';
import './data.dart';
import './item_widget.dart';

class InfoPage extends StatelessWidget {
  final bool showTitle;
  final List<InfoItem> dataList;

  const InfoPage({Key key, this.showTitle = false, this.dataList = infoData})
      : super(key: key);
  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        if (showTitle)
          Container(
            alignment: Alignment.centerLeft,
            padding: EdgeInsets.all(10.0),
            child: Text(
              '最新资讯',
              style: TextStyle(fontWeight: FontWeight.w600),
            ),
          ),
        Column(
          children: dataList.map((e) => ItemWidget(e)).toList(),
        )
      ],
    );
  }
}
